﻿<%@ Page Title="Site Details" Language="C#" MasterPageFile="~/MasterPage.master"
    AutoEventWireup="true" CodeFile="View_Site.aspx.cs" Inherits="admin_View_Site" %>

<asp:Content ID="Head" ContentPlaceHolderID="head" runat="Server">
    <link href="../styles/admin.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
     <div id="top_menu">
        <div id="help_button">
            help
        </div>
                                <div id="logout">
            <asp:LoginStatus ID="LoginStatus1" runat="server" LogoutPageUrl="../Default.aspx"
                OnLoggingOut="LoginStatus1_LoggingOut" />
        </div>
    </div>
    <div id="page_title">
        ADMINISTRATION
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <div id="left_content">
        <div class="menu">
            <ul>
                <li><a href="Home.aspx">Home</a></li>
                <li><a href="Mng_Client.aspx">Manage Clients</a></li>
                <li><a href="#" class="current">View Sites Details</a></li>
                <li><a href="Mng_Machine.aspx">Manage Machines</a></li>
                <li><a href="Mng_Comp.aspx">Manage Components</a></li>
                <li><a href="Mng_Report.aspx">Manage Reports</a></li>
                <li><a href="Mng_WO.aspx">Manage Work Order</a></li>
                <li><a href="Mng_FaultsRecom.aspx">Manage Faults Recommendation</a></li>
            </ul>
        </div>
    </div>
    <!-- end of left content -->
    <div id="right_content">
        <div class="content_area">
            <h2>
                Site Details
            </h2>
            <div class="form_box1">
                <asp:FormView ID="FormViewSites" runat="server" DataKeyNames="site_id" DataSourceID="SitesObjectDataSource">
                    <EditItemTemplate>
                        <table>
                            <tr>
                                <td class="label">
                                    Client Name:
                                </td>
                                <td colspan="2">
                                    <asp:DropDownList ID="clientNameDropDownList" runat="server" DataSourceID="ClientObjectDataSource"
                                        DataTextField="clientName" DataValueField="client_id" SelectedValue='<%# Bind("client_id") %>'
                                        CssClass="dropDownList">
                                    </asp:DropDownList>
                                    <asp:ObjectDataSource ID="ClientObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
                                        SelectMethod="GetData" TypeName="DataAccess.i2iPortalTableAdapters.ClientsTableAdapter">
                                    </asp:ObjectDataSource>
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Site ID:
                                </td>
                                <td class="label" colspan="2">
                                    <asp:Label ID="site_idLabel1" runat="server" Text='<%# Eval("site_id") %>' CssClass="fields1" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Site Name:
                                </td>
                                <td colspan="2">
                                    <asp:TextBox ID="siteNameTextBox" runat="server" Text='<%# Bind("siteName") %>' CssClass="fields1" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Status:
                                </td>
                                <td colspan="2">
                                    <asp:DropDownList ID="statusDropDownList" runat="server" SelectedValue='<%# Bind("status") %>'
                                        CssClass="dropDownList">
                                        <asp:ListItem Text="Activated" Value="Activated"></asp:ListItem>
                                        <asp:ListItem Text="Deactivated" Value="Deactivated"></asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td class="Li_buttonC">
                                    <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                                        Text="Update" />
                                </td>
                                <td class="Li_buttonC">
                                    <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                        Text="Cancel" />
                                </td>
                            </tr>
                        </table>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <table>
                            <tr>
                                <td class="label">
                                    Client ID:
                                </td>
                                <td>
                                    <asp:Label ID="client_idLabel" runat="server" Text='<%# Bind("client_id") %>' CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Site ID:
                                </td>
                                <td>
                                    <asp:Label ID="site_idLabel" runat="server" Text='<%# Eval("site_id") %>' CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Site Name:
                                </td>
                                <td>
                                    <asp:Label ID="siteNameLabel" runat="server" Text='<%# Bind("siteName") %>' CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Status:
                                </td>
                                <td>
                                    <asp:Label ID="statusLabel" runat="server" Text='<%# Bind("status") %>' CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                                <td class="Li_buttonC">
                                    <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
                                        Text="Edit" />
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:FormView>
                <asp:ObjectDataSource ID="SitesObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetDataBySiteID" TypeName="DataAccess.i2iPortalTableAdapters.SitesTableAdapter"
                    UpdateMethod="Update" DeleteMethod="Delete" InsertMethod="Insert">
                    <DeleteParameters>
                        <asp:Parameter Name="Original_site_id" Type="Int32" />
                    </DeleteParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="siteName" Type="String" />
                        <asp:Parameter Name="client_id" Type="Int32" />
                        <asp:Parameter Name="status" Type="String" />
                        <asp:Parameter Name="Original_site_id" Type="Int32" />
                    </UpdateParameters>
                    <SelectParameters>
                        <asp:QueryStringParameter Name="site_id" QueryStringField="site_id" Type="Int32" />
                    </SelectParameters>
                    <InsertParameters>
                        <asp:Parameter Name="siteName" Type="String" />
                        <asp:Parameter Name="client_id" Type="Int32" />
                        <asp:Parameter Name="status" Type="String" />
                    </InsertParameters>
                </asp:ObjectDataSource>
            </div>
        </div>
        <div class="content_area2">
            <h2>
                Machine on Site
            </h2>
            <div class="form_box">
                <asp:GridView ID="GridViewMachine" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                    DataKeyNames="machine_id" DataSourceID="MachineObjectDataSource" OnSelectedIndexChanged="GridViewMachine_SelectedIndexChanged"
                    AllowPaging="True" OnDataBound="GridViewMachine_DataBound">
                    <Columns>
                        <asp:BoundField DataField="machineName" HeaderText="Machine Name" SortExpression="machineName"
                            ItemStyle-CssClass="column">
                            <ItemStyle CssClass="column" />
                        </asp:BoundField>
                        <asp:BoundField DataField="status" HeaderText="Status" SortExpression="status" ItemStyle-CssClass="column">
                            <ItemStyle CssClass="column" />
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="Photo" SortExpression="photo">
                            <EditItemTemplate>
                                <asp:TextBox ID="photoTextBox" runat="server" Text='<%# Bind("photo") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="photoLabel" runat="server" Text='<%# Bind("photo") %>'></asp:Label>
                            </ItemTemplate>
                            <ItemStyle CssClass="column" />
                        </asp:TemplateField>
                        <asp:CommandField SelectText="Details..." ShowSelectButton="True">
                            <ItemStyle CssClass="column" />
                        </asp:CommandField>
                    </Columns>
                    <HeaderStyle CssClass="header" />
                </asp:GridView>
                <asp:ObjectDataSource ID="MachineObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetDataBySiteID" TypeName="DataAccess.i2iPortalTableAdapters.MachinesTableAdapter"
                    DeleteMethod="Delete">
                    <DeleteParameters>
                        <asp:Parameter Name="Original_machine_id" Type="Int32" />
                    </DeleteParameters>
                    <SelectParameters>
                        <asp:QueryStringParameter Name="site_id" QueryStringField="site_id" Type="Int32" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <br />
                <asp:Button ID="CreateMachineButton" runat="server" Text="Add New Machine" OnClick="CreateMachineButton_Click"
                    CssClass="buttons" />
            </div>
        </div>
        <asp:LinkButton ID="BackButton" runat="server" PostBackUrl="Mng_Site.aspx" CssClass="backbtn">Back</asp:LinkButton>
        <!-- end of right content -->
    </div>
</asp:Content>
